package com.xqkad.myplayer.info;

import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;

public class MusicInfo implements Parcelable {
    private static final String KEY_isNet = "isNet";
    private static final String KEY_id = "id";
    private static final String KEY_album_id = "album_id";
    private static final String KEY_artist_id = "artist_id";
    private static final String KEY_title = "title";
    private static final String KEY_album = "album";
    private static final String KEY_artist = "artist";
    private static final String KEY_data = "data";
    private static final String KEY_duration = "duration";
    private static final String KEY_size = "size";

    public boolean isNet;
    public String id;
    public int album_id;
    public long artist_id;
    public String title;
    public String album;
    public String artist;
    public String data;
    public int duration;
    public int size;

    public static final Creator<MusicInfo> CREATOR = new Creator<MusicInfo>() {
        @Override
        public MusicInfo createFromParcel(Parcel source) {
            MusicInfo info = new MusicInfo();
            Bundle bundle = source.readBundle();

            info.isNet = bundle.getBoolean(KEY_isNet);
            info.id=bundle.getString(KEY_id);
            info.album_id=bundle.getInt(KEY_album_id);
            info.artist_id=bundle.getLong(KEY_artist_id);
            info.title=bundle.getString(KEY_title);
            info.album=bundle.getString(KEY_album);
            info.artist=bundle.getString(KEY_artist);
            info.data=bundle.getString(KEY_data);
            info.duration=bundle.getInt(KEY_duration);
            info.size=bundle.getInt(KEY_size);

            return info;
        }

        @Override
        public MusicInfo[] newArray(int size) {
            return new MusicInfo[0];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(KEY_isNet,isNet);
        bundle.putString(KEY_id,id);
        bundle.putInt(KEY_album_id,album_id);
        bundle.putLong(KEY_artist_id,artist_id);
        bundle.putString(KEY_title,title);
        bundle.putString(KEY_album,album);
        bundle.putString(KEY_artist,artist);
        bundle.putString(KEY_data,data);
        bundle.putInt(KEY_duration,duration);
        bundle.putInt(KEY_size,size);
        dest.writeBundle(bundle);
    }
}
